Skip to content

feat: add mix openapi.export task#1917

Draft
mandarini wants to merge 2 commits into
mainfrom
ci/openapi-drift-check
Draft

feat: add mix openapi.export task#1917
mandarini wants to merge 2 commits into
mainfrom
ci/openapi-drift-check

Conversation

@mandarini
Copy link
Copy Markdown
Contributor

@mandarini mandarini commented May 27, 2026

What this is

  • A mix openapi.export task that materializes the OpenApiSpex-generated REST spec to priv/openapi.json, plus a PR-time drift gate.

What maintainers need to do

  • Bootstrap once: mix openapi.export, commit priv/openapi.json.
  • On future PRs touching lib/realtime_web/: re-run the task and commit the updated snapshot.

What it's used for

  • Today the REST management spec only exists at runtime via /api/openapi. Committing a snapshot makes it a static, versioned artifact SDKs and type generators can pin to.
  • Scope is REST only. The channel protocol (broadcast, presence, postgres_changes) is intentionally out of scope — would need AsyncAPI separately.

What was added and why

  • lib/mix/tasks/openapi.export.ex — task that writes RealtimeWeb.ApiSpec.spec() JSON to priv/openapi.json (or --output PATH).
  • .github/workflows/openapi.yml — re-runs the task on PRs touching lib/realtime_web/ and fails on git diff if the committed snapshot is stale. Uploads the regenerated spec as an artifact.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant